function buy_now(id_prod)
{
	$("#buy_now_form").css({ 
		display : "block" ,
		position : "fixed" ,
		height: "100%",
		width : "100%",
		top: "0",
		"z-index" : 5000
		});
	$("#buy_now_form").prepend("<div id=\"buy_back\">fff</div>");
	$("#buy_back").css({ 
		"background-color" : "#ffffff" ,
		height: "100%",
		width : "100%",
		position : "absolute" ,
		"z-index" : 3000,
		opacity : "0.6"
		});
	$("#produkt_id").val(id_prod);
}
var check_basket = function (){
	var form = $('#form_buy');
	
	var reqEmail = /^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/;
	var reqTel   = /^[0-9]{9}$/;        
	var reqgg   = /^[0-9]*$/;  

	var email = form.find( 'input[name=email]' );
	var tel = form.find( 'input[name=tel]' );
	var gg = form.find( 'input[name=gg]' );
	
	if( !reqEmail.test(email.val() ) ) {
		alert('Podałeś błędny email!');
		return;
	} 
	if( tel.val() && !reqTel.test( tel.val() ) ) {
		alert('Podałeś błedny numer telefonu! Poprawny format numeru to 123456789');
		return;
	} 
	if( gg.val() && !reqgg.test( gg.val() ) ) {
		alert('Podałeś błędny numer gg!');
		return;
	}
	
	if(!form.find( 'input:radio' ).is( ':checked' ) ){
		alert("Nie wybrałeś formy płatności!" + form.find( 'input[name=channel]' ).val());
		return;
	}
	form.attr('action','basket/pay');
	
	form.submit();
}